import java.util.HashMap;

/**
 * @author admin
 * 剑指 Offer11 53 - I. 在排序数组中查找数字 I
 */
public class Offer53 {

    public int search(int[] nums, int target) {

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int num : nums) {
            map.put(num,map.getOrDefault(num,0)+1);
        }
        return map.get(target) != 0 ? map.get(target) : 0;
    }
    public static void main(String[] args) {

        System.out.println(new Offer53().search(new int[]{5,7,7,8,8,10},8));
    }
}
